<?php
class Plan extends AppModel
{
	public $name = "Plan";


	public function get_plan_id($name, $projectId)
	{
		$result = $this->find(array('name LIKE' => "%{$name}%", 'projectID' => $projectId, 'active' => 1), array('id'));
		return $result['Plan']['id'];
	}

    public function get_plan_name($pId, $projectId)
    {
        $result = $this->find(array('id' => $pId, 'projectID' => $projectId, 'active' => 1), array('name'));
        return $result['Plan']['name'];
    }

    public function get_plan($name, $projectId)
    {
        $result = $this->find(array('name LIKE' => "%{$name}%", 'projectID' => $projectId, 'active' => 1), array('name'));
        return $result['Plan']['name'];
    }

    public function get_plan_fee($plan, $projectId)
    {
        $result = $this->find(array('name LIKE' => "%{$plan}%", 'projectID' => $projectId, 'active' => 1), array('fee'));
        return $result['Plan']['fee'];
    }
}
?>